/*
 * @功能描述: 
 * @版本: v1.0.0
 * @作者: LuAn
 * @Date: 2021-08-30 20:03:05
 * @LastEditTime: 2021-08-31 05:36:03
 */

#include "bsp_beep.h"
#include "bsp_gpio.h"
void beep_init(void)
{
  IOMUXC_SetPinMux(IOMUXC_SNVS_SNVS_TAMPER1_GPIO5_IO01, 0);
  IOMUXC_PAD_t pad_val;
  pad_val.SPEED = IOMUXC_PAD_SPEED_MID;
  pad_val.DSE = IOMUXC_PAD_DSE_R0_1;
  IOMUXC_SetPinConfig(IOMUXC_SNVS_SNVS_TAMPER1_GPIO5_IO01, pad_val.full);
  gpio_init_output(GPIO5, 1, 1);
}
/**
 * @name: 
 * @msg: 
 * @param {int} state， ON -> beep , OFF -> no beep
 * @return {*}
 */
void beep_switch(int state)
{
  if (state == OFF)
  {
    // gpio_pinwrite(GPIO5, 1, 1);
    gpio_set_pins(GPIO5, BSP_GPIO_PIN_1);
  }
  else if (state == ON)
  {
    //gpio_pinwrite(GPIO5, 1, 0);
    gpio_clr_pins(GPIO5, BSP_GPIO_PIN_1);
  }
}
